package com.api.shopapi.service.impl;

import com.api.shopapi.entity.DeviceLXXueYaJi;
import com.api.shopapi.entity.dto.DeviceLXXueYaJiDTO;
import com.api.shopapi.mapper.DeviceLXXueYaJiMapper;
import com.api.shopapi.service.DeviceLXXueYaJiService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("DeviceLXXueYaJiServiceImplOne")
public class DeviceLXXueYaJiServiceImpl implements DeviceLXXueYaJiService {

    @Autowired
    private DeviceLXXueYaJiMapper deviceLXXueYaJiMapper;



    @Override
    public int insert(DeviceLXXueYaJi deviceLXXueYaJi) {
        return deviceLXXueYaJiMapper.insert(deviceLXXueYaJi);
    }

    @Override
    public int update(DeviceLXXueYaJi deviceLXXueYaJi) {
        return deviceLXXueYaJiMapper.update(deviceLXXueYaJi);
    }

    @Override
    public DeviceLXXueYaJi getByUserCode(String userCode) {
        return deviceLXXueYaJiMapper.getByUserCode(userCode);
    }

    @Override
    public DeviceLXXueYaJi getByDeviceLXXueYaJiCode(String deviceLXXueYaJiCode) {
        return deviceLXXueYaJiMapper.getByDeviceLXXueYaJiCode(deviceLXXueYaJiCode);
    }

    @Override
    public DeviceLXXueYaJi getBySN(String sn) {
        return deviceLXXueYaJiMapper.getBySN(sn);
    }

    @Override
    public PageInfo<DeviceLXXueYaJiDTO> getPage(int pageIndex, int pageSize, String phone, String sn) {
        PageHelper.startPage(pageIndex,pageSize);
        List<DeviceLXXueYaJiDTO> deviceLXXueYaJiDTOList = deviceLXXueYaJiMapper.getPage(phone, sn);
        return new PageInfo<>(deviceLXXueYaJiDTOList);
    }
}
